package com.example.ross.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.ross.entity.SysUser;
import com.example.ross.dao.SysUserMapper;
import com.example.ross.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author rosszhang
 * @since 2023-05-06
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    /**
     * 根据用户名查询用户信息
     *
     * @param userName 用户名
     * @return
     */
    @Override
    public SysUser getUserByUsername(String userName) {
        LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysUser::getUserName, userName);
        wrapper.eq(SysUser::getDelFlag, 0);
        return this.baseMapper.selectOne(wrapper);
    }
}
